package cn.edu.dlmu.cogo.framework.data;

import cn.hutool.cache.Cache;
import cn.hutool.cache.CacheUtil;
/**
 * @author yixi
 */
public class SessionCache {

    private static Cache<Action, Object> cache;

    private static long unit;

    public static void initialize(int cacheSize,long cacheUnit){
        cache = CacheUtil.newLRUCache(cacheSize);
        unit = cacheUnit;
    }

    public static void setCache(Action action,Object result){
        cache.put(action, result, unit);
    }

    public static Object getCache(Action action){
        return cache.get(action);
    }
}
